<?php

namespace app\api\validate;

use think\Validate;

class Article extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'	=>	['规则1','规则2'...]
     *
     * @var array
     */	
	protected $rule = [
            'article_id'=>'require:number',
            'user_id'=>'require|number',
            'num'=>'number',
            'page'=>'number',
            'article_uid'=>'require|number',
            'article_title'=>'require|chsDash',
            'article_content'=>'require'
        ];
    
    /**
     * 定义错误信息
     * 格式：'字段名.规则名'	=>	'错误信息'
     *
     * @var array
     */	
    protected $message = [];
    
    /**
     * 定义验证场景
     */
    protected $scene = [
        'index'=>['user_id','num','page'],
        'save'=>['article_uid','article_title'],
        'read'=>['article_id'],
        'update'=>['article_id','article_title','article_content'],
        'delete'=>['article_id'],
    ];
}
